//  https://www.luogu.com.cn/problem/P1443

#include<iostream>
#include<queue>
#include<cstring>
using namespace std;

int n, m, x, y;
const int N = 410;
int dist[N][N];
typedef pair<int, int> pii;
int dx[] = { 1,2,1,2,-1,-2,-2,-1 };
int dy[] = { 2,1,-2,-1,-2,-1,1,2 };

void bfs()
{
    memset(dist, -1, sizeof dist);
    queue<pii> q;
    q.push({ x,y });
    dist[x][y] = 0;
    while (q.size())
    {
        auto t = q.front();q.pop();
        int i = t.first, j = t.second;
        for (int k = 0;k < 8;k++)
        {
            int x = i + dx[k], y = j + dy[k];
            if (x<1 || x>n || y<1 || y>m) continue;
            if (dist[x][y] != -1) continue;
            dist[x][y] = dist[i][j] + 1;
            q.push({ x,y });
        }
    }
}
int main()
{
    cin >> n >> m >> x >> y;
    bfs();

    for (int i = 1;i <= n;i++)
    {
        for (int j = 1;j <= m;j++)
            cout << dist[i][j] << " ";
        cout << endl;
    }
    return 0;
}